
# def greet_user(username):
#     print(f"Hello,{username.title()}!")
#
# greet_user('tom')
#
# def describe_pet(pet_name,animal='dog'):
#     print(f"\nI have a {animal}")
#     print(f"My {animal} is {pet_name.title()} ")
#
# describe_pet(pet_name='dog')
# describe_pet(pet_name='cat',animal='小黑')
# describe_pet('chicken')
#
#
# def get_formatted_name(first_name,last_name,middle_name=''):
#     if middle_name:
#         full_name = f"{first_name} {middle_name} {last_name}"
#     else:
#         full_name = f"{first_name} {last_name}"
#     return full_name.title()
#
# mus = get_formatted_name('tt','omy')
# print(mus)
# mu = get_formatted_name('cc','bb','aa')
# print(mu)
#
#
# def build_name(first_name,last_name,age = None):
#     person = {'first':first_name,'last':last_name}
#     if age:
#         person['age'] = age
#     return person
# s1 = build_name('cc','vv',age=18)
# print(s1)
#
#
# requested_toppings = []
# if requested_toppings:
#     for requested_topping in requested_toppings:
#         print(f"Adding {requested_topping}.")
# else:
#     print(f"Sorry, we don't have.")
#
#
# aliens = []
# for alien_number in range(30):
#     new_alien = {'color': 'green', 'points': 5, 'speed': 'slow'}
#     aliens.append(new_alien)
#
# for alien in aliens[:3]:
#     if alien['color'] == 'green':
#         alien['color'] = 'yellow'
#         alien['speed'] = 'medium'
#         alien['points'] = 10
#
# # Show the first 5 aliens.
# print(aliens)
# for alien in aliens[:5]:
#     print(alien)
# print("...")


# def get_formatted_name(first_name,last_name):
#     full_name = f"{first_name} {last_name}"
#     return full_name.title()
#
# while True:
#     print('\nTell me you name:')
#     print('("q is exit")')
#     name1 = input('First name:')
#     if name1 == 'q':
#         break
#     name2 = input('Last name:')
#     if name2 == 'q':
#         break
#
#     full_name =  get_formatted_name(name1,name2)
#     print(f"\n{full_name}")




# def greet_users(names):
#     for name in names:
#         print(f"\nHello,{name}!")
#
# usernames = ['Tom','Jack','Jane']
# greet_users(usernames)
#
#
# def print_modles(unprinted_designs,completed_modles):
#     while unprinted_designs:
#         current_deign = unprinted_designs.pop()
#         print(f"Printing modle:{current_deign}")
#         completed_modles.append(current_deign)
#
#
#
# def show_completed_modles(complete_ms):
#     for complete_m in complete_ms:
#         print(f"is {complete_m}")
#
#
# unprinted_designss = ['phone','robt','pendant']
# completed_modless = []
#
# print_modles(unprinted_designss[:],completed_modless)    #[:] 创建副本
# show_completed_modles(completed_modless)
#
# print(unprinted_designss)



# 可变参数 可传任意个数形参
def make_pizza(size,*toppings):
    print(f"\npizza size is {size}")
    for topping in toppings:
        print(f"-{topping}")

make_pizza(16,'pepperoni')
make_pizza(22,'mushrooms','extra cheese')



# 关键字参数  参数打印出来为字典形式
# def build_profile(first,last,**kwargs):
#     kwargs['firsts'] = first
#     kwargs['lasts'] = last
#     return kwargs
#
# build_user = build_profile('ll','kk',oo='ii',jj='tt')
# print(build_user)


# 任意个数、任意类型的参数
# def user(*args,**kwargs):
#     kwargs['a'] = args
#     kwargs['b'] = args
#     return kwargs
#
# user_info = user('mm','nn','ll',oo = 'yy')
# print(user_info)








